package com.ica.model.command;

import com.ica.model.command.util.SmsManagerAdaptor;
import com.ica.model.contact.ContactGroup;

import android.content.Context;

/**
 * @author   Hector
 */
public class SendSmsCommand extends AbstractCommand {

	/**
	 * @uml.property  name="receiver"
	 * @uml.associationEnd  
	 */
	private ContactGroup receiver;
	/**
	 */
	private String body;
	/**
	 * @uml.property  name="smsManagerAdaptor"
	 * @uml.associationEnd  
	 */
	private static SmsManagerAdaptor smsManagerAdaptor = null;

	public SendSmsCommand() {	
		super();
		if (smsManagerAdaptor==null) {
			smsManagerAdaptor = new SmsManagerAdaptor();
		}
	}
	
	/**
	 * @param  receiver
	 * @uml.property  name="receiver"
	 */
	public void setReceiver(ContactGroup receiver) {	
		this.receiver = receiver;
	}
	
	public void setTextMessage(String body) {	
		this.body = body;
	}

	@Override
	public boolean execute(Context context) {	
		smsManagerAdaptor.sendSms(receiver, body);
		log("Send SMS Command executed");
		return true;
	}
}
